import { GCellRenderer } from "../../../../com/mui/controls/GCellRenderer";
import { GTextFormat } from "../../../common/GTextFormat";
import { FontUtil } from "../../../common/font/FontUtil";
import { ObjCreate } from "../common/ObjCreate";
import { DamageData } from "./data/DamageData";
import { Cache } from "../../cache/Cache";
import { GlobalStyle } from "../../../common/global/GlobalStyle";
//class PeaceFieldDamageRender
    
    export  class PeaceFieldDamageRender extends GCellRenderer
    {
        constructor()
        {
            super();
            this.createChildren();
            return;
        }

        /* internal  */createChildren(): void
        {
            var loc1=new GTextFormat(FontUtil.songtiName, 12, 11661311);
            loc1.align = flash.text.TextFormatAlign.CENTER;
            this._tfRank = ObjCreate.createTextField("", 5, 5, 50, 20, this, loc1);
            this._tfName = ObjCreate.createTextField("", 55, 5, 90, 20, this, loc1);
            this._tfDamage = ObjCreate.createTextField("", 145, 5, 60, 20, this, loc1);
            return;
        }

        public /* override */ set data(arg1: Object)
        {
            if (typeof arg1 === "damagedata") 
            {
                this._hurt = arg1 as DamageData;
                this.updateView();
            }
            return;
        }

        /* internal  */updateView(): void
        {
            this._tfRank.text = this._hurt.rank.toString();
            this._tfName.text = this._hurt.hurt.name;
            this._tfDamage.text = this._hurt.hurt.hurt.toString();
            if (this._hurt.hurt.entityId.id != Cache.instance.role.entityInfo.entityId.id) 
            {
                this._tfRank.textColor = GlobalStyle.color1Uint;
                this._tfName.textColor = GlobalStyle.color1Uint;
                this._tfDamage.textColor = GlobalStyle.color1Uint;
            }
            else 
            {
                this._tfRank.textColor = GlobalStyle.color6Uint;
                this._tfName.textColor = GlobalStyle.color6Uint;
                this._tfDamage.textColor = GlobalStyle.color6Uint;
            }
            return;
        }

        /* internal */ /* var */_tfRank: Object /* flash.text.TextField */;

        /* internal */ /* var */_tfName: Object /* flash.text.TextField */;

        /* internal */ /* var */_tfDamage: Object /* flash.text.TextField */;

        /* internal */ /* var */_hurt: DamageData;
    }
